package priv.mill.jdbc.dao;

import java.util.HashMap;
import java.util.Map;

public class DaoFactory {

	private static Map<Class<? extends IDao>, IDao> daos = new HashMap<>();
	
	public static IDao getInstence(Class<? extends IDao> clzz) throws Exception {
		IDao iDao = daos.get(clzz);
		if(iDao==null) {
			iDao = clzz.getConstructor().newInstance();
			daos.put(clzz, iDao);
		}
		return iDao;
	}
}
